import React, { useContext } from "react";
import { RandomFactorContext, UserContext } from "../context";

export default function LogoutButton() {
    const {value,setValue} = useContext(RandomFactorContext)
  return (
    <button onClick={()=>{
        setValue(value+1)
    }}>
      <UserContext.Consumer>
        {(user) => (
          <span>
        我是:{user.username}退出登录
        随机数:{value}
          </span>
        )}
      </UserContext.Consumer>
    </button>
  );
}
